package com.ysd.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.dao.impl.ChanPinXiLieDaoImpl;
import com.ysd.dao.impl.ChanPinXiangQingDaoImpl;
import com.ysd.entity.ChanPinXiLie;
import com.ysd.entity.ChanPinXiangQing;

public class MoHuServlet extends HttpServlet {

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		//产品类型
		ChanPinXiLieDaoImpl lDao = new ChanPinXiLieDaoImpl();
		List<ChanPinXiLie> lList = lDao.getChanPinXiLieList();
		request.setAttribute("lList", lList);
		
		
		
		// 模糊查询
		String chanPinName = request.getParameter("mohu");
		ChanPinXiangQingDaoImpl chaxunDao = new ChanPinXiangQingDaoImpl();
		List<ChanPinXiangQing> chaxunList = chaxunDao.getChanPinXiangQing(chanPinName);
		request.setAttribute("chaxunList", chaxunList);
		
		//接受前台传来的参数
		
		
		
		request.getRequestDispatcher("mohu.jsp").forward(request, response);
		
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

}
